import { Label } from 'cc';
import { ecsclass, EcsComponent } from '../../../../../../../../pkg-export/@gamex/cc-ecs';
import { MyEntity } from '../entity/MyEntity';

@ecsclass('EnemyComponent')
export class EnemyComponent extends EcsComponent<MyEntity> {
    static allowRecycling = true;
    protected onRemove() {
        this._maxHp = 1;
        this.hp = this.maxHp;
    }

    /**最大血量 */
    private _maxHp = 2;
    public get maxHp() {
        return this._maxHp;
    }
    public set maxHp(value) {
        if (value < 0) {
            value = 0
        }
        this._maxHp = value;
    }

    /**血量 */
    private _hp = 2;
    public get hp() {
        return this._hp
    }
    public set hp(value) {
        if (value < 0) {
            value = 0
        }
        this._hp = value
    }

    /** 是否可射击 */
    private _canShoot = true;
    public get canShoot() {
        return this._canShoot;
    }
    public set canShoot(value) {
        this._canShoot = value;
    }

    /** 攻击力 */
    private _attack = 1;
    public get attack() {
        return this._attack;
    }
    public set attack(value) {
        this._attack = value;
    }

    /** 射击间隔 */
    private _interval = 2;
    public get interval() {
        return this._interval;
    }
    public set interval(value) {
        this._interval = value;
    }

    /** 得分 */
    private _score = 10;
    public get score() {
        return this._score;
    }
    public set score(value) {
        this._score = value;
    }

}